﻿<Window
    x:Class="SanctusSoftware.CcliSongSelectImporter.SettingsWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SanctusSoftware.CcliSongSelectImporter"
    Title="CCLI SongSelect Importer Settings"
    MinHeight="300"
    MinWidth="380"
    Height="300"
    Width="380"
    WindowStartupLocation="CenterOwner"
    ResizeMode="CanResizeWithGrip">
    <Window.Resources>
        <ResourceDictionary>
            <Style
                TargetType="{x:Type Button}"
                x:Key="CommandButton">
                <Setter
                    Property="Width"
                    Value="75" />
                <Setter
                    Property="Height"
                    Value="22" />

            </Style>
            <Style
                TargetType="{x:Type Button}"
                x:Key="ToolbarButton">
                <Setter
                    Property="Width"
                    Value="24" />
                <Setter
                    Property="Height"
                    Value="24" />
            </Style>
            <local:BooleanVisibilityConverter
                x:Key="BooleanVisibilityConverter" />
        </ResourceDictionary>
    </Window.Resources>
    <Grid
        Background="#F0F0F0">
        <Grid.RowDefinitions>
            <RowDefinition
                Height="*" />
            <RowDefinition
                Height="Auto" />
        </Grid.RowDefinitions>
        <Border
            Grid.Row="0"
            Background="White"
            BorderBrush="DarkGray"
            BorderThickness="1"
            Margin="7"
            Padding="7">
            <TabControl
                Grid.Column="0"
                Grid.Row="0"
                Grid.ColumnSpan="2">
                <TabItem
                    Header="Libraries">
                    <Grid
                        Margin="5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                                Width="*" />
                            <ColumnDefinition
                                Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <ListBox
                            x:Name="_LibraryListBox"
                            Grid.Column="0"
                            ItemsSource="{Binding Path=Settings.Libraries, Mode=OneWay}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel
                                        Orientation="Vertical">
                                        <TextBlock
                                            FontWeight="Bold"
                                            Text="{Binding Path}" />
                                        <TextBlock
                                            
                                            FontStyle="Italic"
                                            Visibility="{Binding IncludeSubdirectories, Converter={StaticResource BooleanVisibilityConverter}}">Include Sub-Directories</TextBlock>
                                        <TextBlock
                                            FontStyle="Italic"
                                            Visibility="{Binding IncludeSubdirectories, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=True}">Don't Include Sub-Directories</TextBlock>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <StackPanel
                            Grid.Column="1"
                            Orientation="Vertical">

                            <Button
                                x:Name="_AddLibraryButton"
                                Margin="7 7 7 0"
                                Style="{StaticResource ToolbarButton}"
                                Click="_AddLibraryButton_Click">+</Button>
                            <Button
                                x:Name="_RemoveLibraryButton"
                                Margin="7 7 7 0"
                                Style="{StaticResource ToolbarButton}"
                                Click="_RemoveLibraryButton_Click">-</Button>
                        </StackPanel>

                    </Grid>
                </TabItem>
                <TabItem
                    Header="Information">
                    <Grid
                        Margin="5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                                Width="Auto" />
                            <ColumnDefinition
                                Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="Auto" />
                        </Grid.RowDefinitions>
                        <Label>CCLI Number:</Label>
                        <TextBox
                            Grid.Column="1"
                            Grid.Row="0"
                            Text="{Binding Settings.OrganizationInformation.CcliNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                    </Grid>
                </TabItem>
            </TabControl>

        </Border>
        <StackPanel
            Grid.Row="1"
            Orientation="Horizontal"
            HorizontalAlignment="Right">
            <Button
                x:Name="_OKButton"
                Grid.Column="0"
                Grid.Row="1"
                Margin="0 0 0 7"
                HorizontalAlignment="Right"
                Style="{StaticResource CommandButton}"
                Click="_OKButton_Click">OK</Button>
            <Button
                x:Name="_CancelButton"
                Grid.Column="1"
                Grid.Row="1"
                Margin="7 0 14 7"
                HorizontalAlignment="Right"
                Style="{StaticResource CommandButton}"
                Click="_CancelButton_Click">Cancel</Button>
        </StackPanel>

    </Grid>
</Window>
